r = 1 gotdagger = 1 troll = 1 SCREEN 12 COLOR 7, 0 CLS DIM SHARED DOOM AS DOUBLE Minutes = 10 Seconds = 0 GameTime = Minutes * 60 + Seconds DIM directions(1 TO 9) AS STRING directions(1) = "SOUTH" directions(2) = "NORTH OR EAST" directions(3) = "EAST OR WEST" directions(4) = "NORTH OR WEST" directions(5) = "NORTH, SOUTH, EAST, OR WEST" directions(6) = "WEST" directions(7) = "EAST" directions(8) = "WEST OR SOUTH" directions(9) = "EAST" PRINT "" PRINT "" PRINT "Upon the day of which your Uncle had died. He left you ten acres of land." PRINT "Placed in the middle of nowhere and the ruins of a old cabin now wait for" PRINT "the Earth to claim what's left of it's materials. Deciding, that it would" PRINT "be a perfect idea to venture forth and examine what is now yours." PRINT "" DO: LOOP UNTIL INKEY$ <> "" DOOM = TIMER(0.001) + GameTime 'change this to to desied time for the game to run DO CLS PRINT PRINT PRINT " " PRINT " " PRINT " " PRINT " Unwanted Visitor " PRINT " " PRINT " Written by " PRINT " " PRINT " D.B. Taylor" PRINT "" PRINT " Copyright (c) 2015" PRINT "" PRINT SPACE$(38); IF INSTR(directions(r), "NORTH") THEN PRINT "N" ELSE PRINT PRINT "*---------------------------------* "; IF INSTR(directions(r), "WEST") THEN PRINT "W"; ELSE PRINT " "; PRINT " + "; IF INSTR(directions(r), "EAST") THEN PRINT "E"; ELSE PRINT " "; PRINT " *------------------------------------*" PRINT SPACE$(38); IF INSTR(directions(r), "SOUTH") THEN PRINT "S" ELSE PRINT PRINT PRINT "If you are stuck just type HELP." PRINT GOSUB ROOM GOSUB parser LOOP ROOM: IF r = 1 THEN: GOSUB r1 IF r = 2 THEN: GOSUB r2 IF r = 3 THEN: GOSUB r3 IF r = 4 THEN: GOSUB r4 IF r = 5 THEN: GOSUB r5 IF r = 6 THEN: GOSUB r6 IF r = 7 THEN: GOSUB r7 IF r = 8 THEN: GOSUB r8 IF r = 9 THEN: GOSUB r9 RETURN parser: PRINT "> "; cmd$ = GrabInput cmd$ = LTRIM$(RTRIM$(UCASE$(cmd$))) IF cmd$ = "END" OR cmd$ = "QUIT" OR cmd$ = "EXIT" OR cmd$ = "Q" THEN END END IF IF cmd$ = "HELP" OR cmd$ = "H" OR cmd$ = "?" THEN CLS PRINT "HERE ARE SOME BASIC COMMANDS THAT CAN BE USED IN THE GAME..." PRINT PRINT "NORTH, EAST ,SOUTH, AND WEST - MOVE TO AN AVAILABLE LOCATION" PRINT "EXAMINE (OBJECT) - EXAMINE AN OBJECT" PRINT "USE (OBJECT) - USE AN OBJECT" PRINT "TAKE (OBJECT) - TAKE OR MOVE AN OBJECT" PRINT "INVENTORY - VIEW YOUR INVENTORY" PRINT "DRINK - DRINK BEER" PRINT "UNLOCK - UNLOCK DOOR" PRINT "HELP - VIEW THIS SCREEN" PRINT "END - END GAME" PRINT PRINT "PRESS ANY KEY...": SLEEP DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF cmd$ = "INVENTORY" OR cmd$ = "INV" OR cmd$ = "ITEMS" OR cmd$ = "I" THEN CLS PRINT "INVENTORY..." PRINT IF gotdagger = 1 THEN: PRINT "Why not bring a dagger with you!" PRINT PRINT "PRESS ANY KEY..." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF cmd$ = "GO NORTH" OR cmd$ = "NORTH" OR cmd$ = "N" THEN IF r = 2 THEN: r = 1: GOTO moved IF r = 4 THEN: r = 5: GOTO moved IF r = 5 THEN: r = 6: GOTO moved END IF IF cmd$ = "GO EAST" OR cmd$ = "EAST" OR cmd$ = "E" THEN IF r = 2 THEN: r = 3: GOTO moved IF r = 3 THEN: r = 4: GOTO moved IF r = 7 THEN: r = 5: GOTO moved IF r = 5 THEN: r = 6: GOTO moved IF r = 9 THEN: r = 8: GOTO moved END IF IF cmd$ = "GO SOUTH" OR cmd$ = "SOUTH" OR cmd$ = "S" THEN IF r = 8 THEN: r = 5: GOTO moved IF r = 5 THEN: r = 4: GOTO moved IF r = 1 THEN: r = 2: GOTO moved END IF IF cmd$ = "GO WEST" OR cmd$ = "WEST" OR cmd$ = "W" THEN IF r = 4 THEN: r = 3: GOTO moved IF r = 3 THEN: r = 2: GOTO moved IF r = 6 THEN: r = 5: GOTO moved IF r = 5 THEN: r = 7: GOTO moved IF r = 8 THEN: r = 9: GOTO moved END IF IF (cmd$ = "USE DAGGER") THEN CLS PRINT "What will I do with the dagger? Stab the walls?" DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "EXAMINE TROLL") AND r = 6 THEN CLS PRINT "It stands about four feet tall. It's eye's are a pale white. It" PRINT "wears old torn clothes and looks as if it's hungry. You look into" PRINT "it's eye's and feel as if it has some sorta hold on you." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "EXAMINE DAGGER") AND gotdagger = 1 THEN CLS PRINT "Just a dagger bought at one of those hunting shops." DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "USE DAGGER") AND gotdagger = 1 AND r = 9 THEN CLS GOTO win: DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF IF (cmd$ = "GIVE UP") AND r = 9 THEN CLS GOTO lose: DO: LOOP UNTIL INKEY$ = "" DO: LOOP UNTIL INKEY$ <> "" END IF moved: RETURN r1: PRINT "What a nice da to checkout this old farm land. You are standing" PRINT "at the entrance of the old farm house." RETURN r2: PRINT "The parlor room looks as if it had once greeted hundreds of" PRINT "guests." RETURN r3: PRINT "A strange smell wofts in through the house. As if someone has" PRINT "died here recently." RETURN r4: PRINT "You hear buzzing? Like from insects? But where are they coming from?" RETURN r5: PRINT "The dining room. The buzzing grows louder. Though the room is void" PRINT "of furniture." RETURN r6: PRINT "What I suppose is the kitchen. Nothing but a hole in the wall where" PRINT "the sink use to be. You have the strange feeling that you are being" PRINT "watched." RETURN r7: PRINT "Standing before you...in the shadows...is that a troll?" RETURN r8: PRINT "The smell quickly vanishes as you are starting to feel like an" PRINT "unwelcome guest here." RETURN r9: PRINT "A dead end. Looks as if this was once a back door but was boarded" PRINT "up." RETURN win: COLOR 2, 0 CLS PRINT "You expose your dagger which causes the Troll to flee the house" PRINT "and return back into the wilderness. It seems gone, but I don't" PRINT "think I'll be coming back here no more." PRINT DO: LOOP UNTIL INKEY$ <> "" END lose: COLOR 2, 0 CLS PRINT "As you drop the dagger on the floor. The Troll just stares at" PRINT "you like a fool and steals the dagger. It slowly walks out of" PRINT "the farm house. Leaving you, cause you gave up so easily." PRINT DO: LOOP UNTIL INKEY$ <> "" END FUNCTION GrabInput$ x = POS(0) y = CSRLIN maxwidth = _WIDTH - x PCOPY 0, 1 'make a backup copy of the screen DO k = _KEYHIT i$ = INKEY$ LOOP UNTIL k = 0 AND INKEY$ = "" 'clear the keyboard buffer DO _LIMIT 30 PCOPY 1, 0 LOCATE y, x: PRINT Userinput$ k = _KEYHIT SELECT CASE k CASE 8 Userinput$ = LEFT$(Userinput$, LEN(Userinput$) - 1) CASE 65 TO 90, 97 TO 122, 32 Userinput$ = UCASE$(Userinput$ + CHR$(k)) END SELECT timerleft## = (DOOM - TIMER(0.001)) minutes = timerleft## \ 60 seconds = timerleft## - minutes * 60 LOCATE 2, 32: PRINT USING " ###:##.###"; minutes, seconds IF timerleft## <= 0 THEN GOTO doomed _DISPLAY LOOP UNTIL k = 13 GrabInput$ = Userinput$ _AUTODISPLAY EXIT FUNCTION doomed: CLS PRINT "You spend to much time wandering around and now it's" PRINT "dark out, too dark to explore anymore. Pity...would've" PRINT "been nice to see our dark guest!" _DISPLAY END END SUB